package cn.webrx;

public class Gen6<T> {
    private T t;
    public void set(T t){
        this.t = t;
    }
    public T get(){
        return this.t;
    }

    //? 代表无界通配符
    public void print(Gen6<?> t){
        System.out.println(t);
    }

    @Override
    public String toString() {
        return t.toString();
    }

    public static void main(String[] args) {
        Gen6<String> g1 = new Gen6<>();
        g1.set("str");

        Gen6<Integer> g2 = new Gen6<>();
        g2.set(100);
        g2.print(g2);

        g1.print(g2);
        g1.print(g1);

    }
}
